﻿@using DotNetClub.Core.Entity
@model List<Topic>

<visible condition="Model.Count > 0">
    @foreach (var topic in Model)
    {
    <div class="cell">
        <a class="pull-left" asp-action="Index" asp-controller="User" asp-route-userName="@topic.CreateUser.UserName">
            <useravatar email="@topic.CreateUser.Email" title="@topic.CreateUser.UserName" size="28"></useravatar>
        </a>

        <span class="text-muted pull-left reply-count">
            <span class="text-info">@topic.ReplyCount</span>
            <span class="text-muted reply-seperator">/</span>
            <small class="text-muted">@topic.VisitCount</small>
        </span>

        <span class="category pull-left">
            <span class="recommand" condition="topic.Top">置顶</span>

            <span class="recommand" condition="topic.Recommand">精华</span>

            <span condition="!topic.Top && !topic.Recommand">@topic.CategoryModel.Name</span>            
        </span>

        <a class="pull-right last-reply text-muted" asp-action="Index" asp-controller="Topic" asp-route-id="@topic.ID" asp-fragment="@(topic.LastReplyUserID.HasValue ? "latest" : "")">
            <visible condition="topic.LastReplyUserID.HasValue">
                <useravatar title="@topic.LastReplyUser.UserName" size="18" email="@topic.LastReplyUser.Email"></useravatar>
            </visible>

            <small>
                <datetime date="@topic.CreateDate"></datetime>
            </small>
        </a>

        <div class="text-nowrap topic-title-wrapper">
            <a asp-action="Index" asp-controller="Topic" asp-route-id="@topic.ID" class="topic-title">@topic.Title</a>
        </div>
    </div>
    }
</visible>
<visible condition="Model.Count == 0">
    <div class="cell">无主题</div>
</visible>